/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package helper;

import dbconnector.DBDriver;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class CompanyHelper 
{
    static PreparedStatement p,pstmt;
    static ResultSet rs;
    
    
public static AO.Company getCompanyBean(String cusername, String cpassword)
{
    try{
         PreparedStatement p= DBDriver.getPrepare("select * from companydetails where cusername=? and cpassword=?");
         p.setString(1, cusername);
         p.setString(2, cpassword);
         ResultSet rs=p.executeQuery();
         if(rs.next())
         {
                AO.Company comp=new AO.Company();
                 comp.setCname(rs.getString("cname"));
                 comp.setCaddress(rs.getString("caddress"));
                 comp.setCfield(rs.getString("cfield"));
                 comp.setCutoff(rs.getInt("cutoff"));
                 comp.setCemail(rs.getString("cemail"));
                 comp.setCcontact(rs.getString("ccontact"));
                 comp.setCusername(rs.getString("cusername"));
                 comp.setCpassword(rs.getString("cpassword"));
                 
                 return comp;

        }          
    }
        catch(Exception e){e.printStackTrace();}
        return null;
    
}
}
